#ifndef WRAP_CODE_GENERATOR__H
#define WRAP_CODE_GENERATOR__H


#include <DefineLibReflection.h>

#include <DefineCommon.h>
#include <CppInfo.h>

//This is the old version of wrap code generation
class WrapCodeGenerator;
typedef SmartPtr(WrapCodeGenerator) WrapCodeGeneratorPtr;
class REFLECTION_DLL WrapCodeGenerator 
{
public:
    WrapCodeGenerator();
    ~WrapCodeGenerator();

    /**The output data of wrap code generation*/
    EList<CppInfo::ClassPtr> m_wrapClassList;

    /**write to file, this is the entry function of this class*/
    void collectionToFiles(CppInfo::CppCollectionPtr collPtr, const EString& dirName);
    /**convert orignal class to wrap class*/
    virtual CppInfo::ClassPtr genWrapClass(CppInfo::ClassPtr c);

    /**write a Class to a h file*/
    void classToFile_h(CppInfo::ClassPtr classPtr, const EString& fileName);
    /**write a Class to a cpp file*/
    void classToFile_cpp(CppInfo::ClassPtr classPtr, const EString& fileName);
    

    /**Called by function 'classToFile_h', generate the macro e.g. #define xxx*/
    virtual void genHeader_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate the '#include <xxx>'*/
    virtual void genInclude_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate class define e.g,
     * 'Class xxx : publice xxxx'
     * 'SmartPtr<xxx>'*/
    virtual void genClassDecl_h(CppInfo::ClassPtr classPtr, EString& content);


    /**Called by function 'classToFile_h', generate orignal ptr variable e.g,:
     * 'osg::ref_ptr<osg::Node> m_origPtr;'*/
    virtual void genClassVariablesOrignalPtr_h(CppInfo::ClassPtr classPtr, EString& content);

    /**Called by function 'classToFile_h', generate orignal ptr set function e.g,:
     * 'virtual void setOrigPtr(intptr_t origPtr)'*/
    virtual void genClassFunSetOrigPtr_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate orignal ptr get function e.g,:
     * 'virtual intptr_t getOrigPtr()'*/
    virtual void genClassFunGetOrigPtr_h(CppInfo::ClassPtr classPtr, EString& content);

    /**Called by function 'classToFile_h', generate fill property function e.g,:
     * 'void fillPropertys()'*/
    virtual void genClassFunFillPropertys_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate updateToProperty_Name liked functions e.g.:
     * 'void updateToProperty_xxx()'*/
    virtual void genClassFunToProperty_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate updateToOrig_Name liked functions e.g.:
     * 'void updateToOrig_xxx()'*/
    virtual void genClassFunToOrig_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate class's constructor function e.g,
     * 'public: xxxx()'*/
    virtual void genClassConstructor_h(CppInfo::ClassPtr classPtr, EString& content);

    /**Called by function 'classToFile_h', generate class's destructor function e.g,
     * 'public: ~xxxx()'*/
    virtual void genClassDestructor_h(CppInfo::ClassPtr classPtr, EString& content);
    /**Called by function 'classToFile_h', generate some constant code that do not change according to different class type*/
    virtual void genClassConstantCode_h(EString& content);
    /**Called by function 'classToFile_h', generate end code of h file e.g.:
     *'#endif'*/
    virtual void genEnd_h(CppInfo::ClassPtr classPtr, EString& content);


    /**Called by function 'classToFile_cpp', generate include list e.g.:
     *'#include <ItemWrap_osg_MatrixTransform_gen.h>'*/
    virtual void genInclude_cpp(CppInfo::ClassPtr classPtr, EString& content);

    /**Deprected*/
    void genRttrReg(CppInfo::ClassPtr classPtr, EString& content);

    /**check if the varType is supportted in UI system, which will affect the result of code generated*/
    virtual bool ifSupportVariableType(const EString& varType);

    /**convert some similar types to one type, example: "const std::string &" will be converted to std::string*/
    virtual EString unifyVariableType(const EString& varType);

    /**convert orignal class name to wrap class name,*/
    virtual EString toWrapClassName(EString name);

    /**append class's content to another class*/
    void copyClass1ToClass2(CppInfo::ClassPtr c1, CppInfo::ClassPtr c2);

    /**Deprected*/
    // void genClassFunctions(CppInfo::ClassPtr classPtr, EString& content);
    /**Deprected*/
    // void genClassFunNewOrigPtr(CppInfo::ClassPtr classPtr, EString& content);

    /**Deprected*/
    // void genRttrEnable(CppInfo::ClassPtr classPtr, EString& content);
};

#endif // WRAP_CODE_GENERATOR__H
